package com.entrogy.dao;

import com.entrogy.bean.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @ClassName CourseSystemMapper
 * @Description
 * @Author luoxingjiang
 * @Date 2019-11-19 下午 6:30
 * @Version 1.0
 **/
@Repository
public interface CourseSystemMapper {

    /**
     * 添加课程
     * @param course
     * @return
     */
    int insertCourse(CourseSystemCourseEntity course);

    /**
     * 插入课程安排数据
     * @param courseArrangeTeacherList
     * @return
     */
//    int insertCourseArrange(CourseSystemCourseArrangeEntity courseArrangeTeacherList);

    /**
     * 插入上课时间
     * @param courseTime
     * @return
     */
    int insertCourseTime(CourseSystemCourseTimeEntity courseTime);

    /**
     * 查询课程
     * @param courseId
     * @param courseName
     * @param schoolCode
     * @param isFinish
     * @param teacherName
     * @param enableStatus
     * @return
     */
    List<CourseSystemCourseEntity> listCourse(@Param("courseId") Integer courseId, @Param("courseName") String courseName, @Param("schoolCode") Integer schoolCode, @Param("isFinish") Boolean isFinish, @Param("teacherName") String teacherName, @Param("enableStatus") Integer enableStatus);

    /**
     * 删除课程
     * @param courseId
     * @return
     */
    int deleteCourse(@Param("courseId") Integer courseId);

    /**
     * 查询开课时间详情
     * @param courseId
     * @return
     */
    List<CourseSystemCourseTimeEntity> listCourseTime(@Param("courseId") Integer courseId);

    /**
     * 删除开课时间详情
     * @param courseId
     * @return
     */
    int deleteCourseTime(@Param("courseId") Integer courseId);

    /**
     * 更新课程
     * @param course
     * @return
     */
    int updateCourse(CourseSystemCourseEntity course);

    /**
     * 插入课程老师安排
     * @param arrange
     * @return
     */
    int insertCourseArrange(CourseSystemCourseArrangeEntity arrange);

    /**
     * 删除课程老师安排
     * @param courseId
     * @return
     */
    int deleteCourseTeacher(@Param("courseId") Integer courseId);

    /**
     * 查询课程教师安排
     * @param courseId
     * @return
     */
    List<CourseSystemCourseArrangeEntity> listCourseTeacherArrange(@Param("courseId") Integer courseId);

    /**
     * 插入课程限制
     * @param courseLimitList
     * @return
     */
    int insertCourseLimit(@Param("courseLimitList") List<CourseSystemCourseLimitEntity> courseLimitList);

    /**
     * 查询课程限制
     * @param courseId
     * @param schoolCode
     * @return
     */
    List<CourseSystemCourseLimitEntity> listCourseLimit(@Param("courseId") Integer courseId, @Param("schoolCode") Integer schoolCode);

    /**
     * 删除课程限制
     * @param courseId
     * @return
     */
    int deleteCourseLimit(Integer courseId);

    /**
     * 插入课程顺序表
     * @param courseTimeId
     * @param courseOrder
     * @param createUserId
     * @return
     */
    int insertCourseOrder(@Param("courseTimeId") Integer courseTimeId, @Param("courseOrder") Integer courseOrder, @Param("createUserId") String createUserId);

    /**
     * 插入课程顺序表
     * @param courseId
     * @return
     */
    int deleteCourseOrder(@Param("courseId") Integer courseId);

    /**
     * 查询上课顺序
     * @param courseTimeId
     * @return
     */
    List<Integer> listCourseOrder(@Param("courseTimeId") Integer courseTimeId);

    /**
     * 查询教师的开课列表
     * @param teacherId
     * @param courseName
     * @param isFinish
     * @return
     */
    List<CourseSystemCourseEntity> listTeacherCourse(@Param("teacherId") String teacherId, @Param("courseName") String courseName, @Param("isFinish") Boolean isFinish);

    /**
     * 查询选课学生
     * @param courseId
     * @param studentName
     * @param studentId
     * @return
     */
    List<ClassStudentEntity> listCourseStudent(@Param("courseId") Integer courseId, @Param("studentName") String studentName, @Param("studentId") Integer studentId);

    /**
     * 选课
     * @param uid
     * @param courseId
     * @param studentId
     * @return
     */
    int insertCourseChoose(@Param("uid") String uid, @Param("courseId") Integer courseId, @Param("studentId") Integer studentId);

    /**
     * 查看学生已选课程
     * @param studentId
     * @return
     */
    List<CourseSystemCourseEntity> listStudentCourse(@Param("studentId") Integer studentId);

    /**
     * 教师查看自己创建的课程
     * @param uid
     * @param courseName
     * @param isFinish
     * @param enableStatus
     * @return
     */
    List<CourseSystemCourseEntity> listTeacherCreateCourse(@Param("uid") String uid, @Param("courseName") String courseName, @Param("isFinish") Boolean isFinish, @Param("enableStatus") Integer enableStatus);

    /**
     * 更新选课信息
     * @param chooseCourse
     * @return
     */
    int updateChooseCourse(CourseSystemChooseCourseEntity chooseCourse);

    /**
     * 查询学生考勤详情
     * @param studentId
     * @param courseId
     * @param weekOrder
     * @param dayOfWeek
     * @param courseOrder
     * @return
     */
    List<CourseSystemAttendanceEntity> listStudentAttendance(@Param("studentId") Integer studentId, @Param("courseId") Integer courseId, @Param("weekOrder") Integer weekOrder, @Param("dayOfWeek") Integer dayOfWeek, @Param("courseOrder") Integer courseOrder);

    /**
     * 插入学生点名记录
     * @param courseAttendanceList
     * @return
     */
    int insertStudentAttendanceRecord(@Param("courseAttendanceList") List<CourseSystemAttendanceEntity> courseAttendanceList);

    /**
     * 更新学生点名记录
     * @param courseAttendance
     * @return
     */
    int updateCheckStudentStatus(CourseSystemAttendanceEntity courseAttendance);

    /**
     * 选了课程的学生计数
     * @param courseId
     * @param classId
     * @return
     */
    int countChooseStudent(@Param("courseId") Integer courseId, @Param("classId") Integer classId);

    /**
     * 查询家长或者孩子的选课记录
     * @param uid
     * @param studentId
     * @param courseName
     * @param teacherName
     * @param isFinish
     * @return
     */
    List<CourseSystemParentCourseEntity> listParentOrStudentCourse(@Param("uid") String uid, @Param("studentId") Integer studentId, @Param("courseName") String courseName, @Param("teacherName") String teacherName, @Param("isFinish") Boolean isFinish);

    /**
     * 查询选课学生，不按班级分类
     * @param courseId
     * @return
     */
    List<StudentBasicInfoEntity> listCourseStudentNotGroup(Integer courseId);

    // 😓
    /**
     * 查询该生的选课信息
     * @param studentId
     * @param courseId
     * @return
     */
    CourseSystemStudentScoreEntity getStudentChooseInfo(@Param("studentId") Integer studentId, @Param("courseId") Integer courseId);

    /**
     * 查询某一条选课的评价信息
     * @param courseChooseId
     * @return
     */
    CourseSystemChooseEvaluateEntity getCourseChooseInfo(@Param("courseChooseId") Integer courseChooseId);
}
